<?php

namespace App\Services\Address;

use App\Services\ProjectValidate;

/**
 * 地址验证层
 * Class ValidateAddress
 * @package App\Services\Article
 */
class ValidateAddress extends ProjectValidate
{

    /**
     * 自定义子类初始化
     * @param array $initData
     * @return mixed
     */
    public function initValidate($initData = [])
    {
        if (!empty($initData['pid'])) {
            $this->rules['pid']  = 'required|numeric';
        }
    }

    /**
     * @var array 验证规则集合
     */
    public $rules = [
        'id'            => 'numeric|min:1',
        'pid'           => 'numeric',
        'name'          => 'required',
        'py_name'       => 'alpha',
        'zipcode'       => 'numeric',
        'special'       => 'numeric',
    ];

    /**
     * @var array 当前验证错误信息
     */
    public $messages = [

    ];
}